1 00:00:00,720 --> 00:00:01,050 All right. 2 00:00:01,050 --> 00:00:07,290 So now that we have our eruption script expanding our lava flow out, let's add the drain effect so 3 00:00:07,290 --> 00:00:09,260 it drains down when it's done. 4 00:00:09,270 --> 00:00:12,900 Let's go to lava and then eruption. 5 00:00:13,890 --> 00:00:18,090 And then I have this eruption or erupt function. 6 00:00:18,090 --> 00:00:24,300 I'm going to copy it, Control C because drain is going to be very similar to control V to paste it, 7 00:00:24,720 --> 00:00:30,900 I'm going to add drain and then I'm not going to change size, I'm going to change position. 8 00:00:30,900 --> 00:00:35,730 I'm going to drop the very large Liverpool down really slow. 9 00:00:35,730 --> 00:00:46,080 So I'll say lava dot position equals lava dot position and then we'll add a vector three. 10 00:00:46,080 --> 00:00:50,820 But I'm going to keep the X and the Z zero. 11 00:00:51,000 --> 00:00:54,180 Y will be the height because we're dealing with possessions. 12 00:00:54,270 --> 00:01:00,480 It doesn't matter that we rotated the part, we're going to make this -0.01. 13 00:01:00,510 --> 00:01:02,460 It's going to drain down slower. 14 00:01:02,820 --> 00:01:03,420 Right? 15 00:01:03,420 --> 00:01:08,730 But if you'll notice, this grew by 0.03, but it grew out of the center. 16 00:01:08,730 --> 00:01:15,300 So each loop iteration, it actually increased by 0.015 this one. 17 00:01:16,010 --> 00:01:20,660 We're going to have to increase this number or we're going to have lava left over and then it'll just 18 00:01:20,660 --> 00:01:21,530 disappear. 19 00:01:22,730 --> 00:01:25,060 Let's increase this three times. 20 00:01:25,070 --> 00:01:32,690 Let's increase that to 40, because we might have subtractions in the terrain or erosions and we want 21 00:01:32,690 --> 00:01:34,790 to see it drain all the way down. 22 00:01:35,360 --> 00:01:39,090 I'm also going to get rid of that 0.1. 23 00:01:39,110 --> 00:01:45,680 I'm going to use the default weight value, which is 0.0 3 seconds about that. 24 00:01:45,680 --> 00:01:45,920 Right. 25 00:01:46,010 --> 00:01:48,400 0.029999. 26 00:01:48,410 --> 00:01:51,980 Like that when we get to the end of our drain. 27 00:01:52,460 --> 00:01:59,240 I want to put the lava flow back to its original size and original position because we're going to do 28 00:01:59,240 --> 00:02:02,030 this periodically in the game and we want it to be ready. 29 00:02:02,240 --> 00:02:05,150 So I'm going to go up to the top of the script. 30 00:02:05,180 --> 00:02:12,770 I'm going to save off the original position and I'll call that POS lava dot position. 31 00:02:13,400 --> 00:02:16,460 And then size is lava dot size. 32 00:02:16,460 --> 00:02:20,390 So I'm saving the original size and the original position right here. 33 00:02:20,540 --> 00:02:25,040 When we get to the end of our drain, I'm going to say lava dot position. 34 00:02:25,370 --> 00:02:27,650 Bring it back to the original position. 35 00:02:28,730 --> 00:02:31,070 Lava dot size. 36 00:02:31,070 --> 00:02:33,230 Bring it back to the original size. 37 00:02:34,340 --> 00:02:34,740 Cool. 38 00:02:34,760 --> 00:02:39,440 Now we just need to call this so after the erupt, let's wait. 39 00:02:39,440 --> 00:02:40,100 I don't know. 40 00:02:40,100 --> 00:02:41,270 Maybe a second. 41 00:02:41,990 --> 00:02:43,730 And then we'll start draining. 42 00:02:45,410 --> 00:02:46,460 See what we got. 43 00:02:47,000 --> 00:02:48,140 Play here. 44 00:02:51,650 --> 00:02:52,310 Here we go. 45 00:02:52,310 --> 00:02:53,300 Let's get high ground. 46 00:02:53,300 --> 00:02:54,650 Even though there's no damage yet. 47 00:02:54,650 --> 00:02:55,220 Right? 48 00:02:57,530 --> 00:02:59,000 It expands out. 49 00:03:00,770 --> 00:03:03,260 We could make it expand all the way out if we wanted. 50 00:03:06,020 --> 00:03:07,760 And now we're going to watch it drop. 51 00:03:14,400 --> 00:03:15,900 That's pretty cool. 52 00:03:16,350 --> 00:03:17,130 All right. 53 00:03:17,130 --> 00:03:21,750 Next video, we'll do damage and now we need an eruption. 54 00:03:21,750 --> 00:03:22,890 Sound to.